css: Change currentColor handling
authorBenjamin Otte <otte@redhat.com>
Fri, 6 Sep 2013 01:01:37 +0000 (03:01 +0200)
committerBenjamin Otte <otte@redhat.com>
Fri, 6 Sep 2013 01:04:09 +0000 (03:04 +0200)
We now pass NULL when the current color should be the default value of
the "color" property and we haven't looked up any value yet. This way we
don't need to look it up all the time and more importantly we can
resolve the default color, which is required because it's a
GtkCssColorValue and not a GtkCssRgbaValue.

Fixes assertions triggering at Polari startup.

gtk/gtkcsscolorvalue.c

index 9972d96a991981b35c6ff53c5fd8471c2f3cf1d9..705e7a3a76ec27d1a9bc7b30e9a178650bbb48d3 100644 (file)
@@ -150,7 +150,6 @@ _gtk_css_color_value_resolve (GtkCssValue             *color,
 
   g_return_val_if_fail (color != NULL, NULL);
   g_return_val_if_fail (provider == NULL || GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
-  g_return_val_if_fail (current != NULL, NULL);
 
   if (dependencies == NULL)
     dependencies = &unused;
@@ -271,7 +270,12 @@ _gtk_css_color_value_resolve (GtkCssValue             *color,
         }
       else
         {
-          return NULL;
+          return _gtk_css_color_value_resolve (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_COLOR)),
+                                               provider,
+                                               NULL,
+                                               0,
+                                               dependencies,
+                                               cycle_list);
         }
       break;
     default:
@@ -320,7 +324,7 @@ gtk_css_value_color_compute (GtkCssValue             *value,
         }
       else
         {
-          current = _gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_COLOR));
+          current = NULL;
           current_deps = 0;
         }
     }